<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>父子组件传值</title>
    <script src="vue.js"></script>
</head>
<body>
<div id="app">
    <counter :count="0"></counter>
    <counter :count="1"></counter>
</div>
<script>

    /*父组件通过属性的形式向子组件传递数据*/
    var counter = {
        props:['count'],
        data:function(){
            return {
                number : this.count
            }
        },
        template:"<div @click='handleClick'>{{number}}</div>",
        methods:{
            handleClick:function () {
                this.number++
            }
        }
    }
    var vm = new Vue({
        el:"#app",
        components:{
            counter:counter
        },
        data:{},
        methods:{}
    });
</script>
</body>
</html>